var box=document.getElementById("box");
	var aa=box.getElementsByTagName("a");
	var uls=box.getElementsByTagName("ul")[0];
	var lis=uls.getElementsByTagName("li");
	var bool=1;
	box.onmouseover=function(){
		aa[0].style.display="";
		aa[aa.length-1].style.display="";
		window.clearInterval(autoDo);
	}
	box.onmouseout=function(){
		aa[0].style.display="none";
		aa[aa.length-1].style.display="none";
		autoDo=window.setInterval(function(){leftDo(0);},3000);
	}
aa[0].onclick=function(){
	if(bool==1){
		bool=0;
		leftDo(0);
	}
	
}
function leftDo(num){
	num+=7;
	if(num<=box.clientWidth){
		lis[0].style.marginLeft=-num+"px";
		window.setTimeout(function(){leftDo(num);},10)
	}else
	{
		uls.appendChild(lis[0]);
		lis[lis.length-1].style.marginLeft="0px";
		bool=1;
	}
}
aa[aa.length-1].onclick=function(){
	if(bool==1){
		bool=0;
		rightDo(0);
	}
}
function rightDo(num){
	if(num==0){
		lis[lis.length-1].style.marginLeft=-box.clientWidth+"px";
		uls.insertBefore(lis[lis.length-1],lis[0]);
	}
	num+=7;
	if(num<=box.clientWidth){
		lis[0].style.marginLeft=(-box.clientWidth+num)+"px";
		window.setTimeout(function(){rightDo(num);},10)	
	}
	else
	{
		bool=1;
	}
}
	var autoDo=window.setInterval(function(){leftDo(0);},3000);
